<?php App::Helper('Toolbar')->setTitle("Payments")->setBtnBack()->Render(array('code'=>'pcjob_payment_top')); ?>
<form method="post">
<div class="field">
	<input type="text" name="data[Search][startdate]" value="<?php echo  isset($jobsrc['startdate'])?$jobsrc['startdate']:"Start Date"; ?>" class="app_input date" style="width:200px;margin-right:5px" />
	<input type="text" name="data[Search][enddate]" value="<?php echo  isset($jobsrc['enddate'])?$jobsrc['enddate']:"End Date"; ?>" class="app_input date" style="width:200px;margin-right:5px" />
</div>
<div class="field">
	<input type="text" name="data[Search][str]" value="<?php echo  isset($jobsrc['str'])?$jobsrc['str']:""; ?>" class="app_input" style="width:200px" />
	<?php echo App::Component('Photocliping')->Helper("Data")->memberListBox("data[Search][member]",(isset($jobsrc['member'])?$jobsrc['member']:"")); ?>
	<input type="submit"  name="data[Search][searchbtn]" value="Search" class="app_button" style="margin:2px;padding:6px;color:#FFF;border:1px solid #B3B3B3;background-color:#003871" />
</div>
</form>
<?php
	$o = ($o == 'DESC') ? 'ASC' : 'DESC';
	App::Module('DataGrid')->clear()->setHeader(Array(
								  "<a href=\"?s=id&o={$o}\">#</a>",
								  "<a href=\"?s=processor&o={$o}\">Processor</a>",
								  "<a href=\"?s=total&o={$o}\">Amount</a>",
								  "<a href=\"?s=order_date&o={$o}\">Payment Date</a>",
								  "Client Name(Balance)",
								  "Options"))
							   ->setFooter($Payments['paging_str']);
		foreach($Payments['data'] as $Payment)
		{
			$Member = App::MemberManager()->Members($Payment['client_id']);
			$deposit = App::Component('Photocliping')->Helper('Data')->getDeposit($Payment['client_id']);

			App::Module('DataGrid')->addRow($Payment['id'],$Payment['processor'],'$' . $Payment['total'],App::Helper('Date')->dateFormated($Payment['order_date']),"{$Member['name']}(\${$deposit})",App::Helper("Html")->linkTag($this->baseUrl("/pcjobs/payment/{$Payment['client_id']}"),"Full Report")
										);
		}
		App::Module('DataGrid')->render();
?>
<?php App::Helper('Toolbar')->setBtnBack()->Render(array('code'=>'pcjob_payment_bottom')); ?>